package com.web.my12306.dao.impl;

import com.web.my12306.dao.IPrivilegeDao;
import com.web.my12306.pojo.CommonConstants;

import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;

public class PrivilegeDaoImpl extends BaseDao implements IPrivilegeDao
{
    @Override
    public Set<String> query(int state)
    {
        Set<String> list=new HashSet<>();
        query("Select url from role_priv,privileges where role_priv.pid=privileges.pid AND rid=?",state);
        try
        {
            while(rs.next())
            {
                String str= CommonConstants.BASEPATH+rs.getString("url");
                list.add(str);
            }

        } catch (SQLException e)
        {
            e.printStackTrace();
        } finally
        {
            closeAll();
        }
        return list;
    }
}
